/**
 * 组件代码
 */
Vue.component('comSougnImage', {
    name: 'comSougnImage',
    props: ['config', 'data'],
    data: function () {
        return {
            content: "",
        }
    },
    computed: {
        myConfig: function () {
            var data = {};
            for (var item of this.config) {
                data[item.id] = item.value;
            }
            var defaultV = {
                imageUrl: data.imageUrl
            };
            return defaultV;
        },
    },
    watch: {
        data: function (oldValue, newValue) {
            this.dataChange();
        }
    },
    mounted() {
        this.dataChange();
    },
    methods: {
        dataChange: function () {
            var data = window.getValue(this.myConfig.imageUrl);
            if (typeof (data[0]) == 'string') {
                this.content = data[0];
            } else if (data[0] != undefined && data[0][0] != undefined) {
                this.content = data[0][0];
            } else {
                this.content = "";
            }
        }
    },
    template: `<div :style="myConfig"><img :src="content" alt=""></div>`,
});
/**
 * 配置项
 * @type {{name: string, id: string, type: string, value: string}[]}
 */
var comSougnImageConfig = [{
    name: "图片地址",
    type: "text",
    value: "",
    id: "imageUrl"
}]
